// pages/index/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 需要标注图片路径
    background: ['../../images/banner1.jpeg', '../../images/banner2.jpeg','../../images/banner3.jpeg'],
    tabList: ['寻主', '寻物'],
    tabSelected: 0,
    list: [
      {
        image: '../../images/banner3.jpeg',
        name: "布加迪",
        region: "江北校区公楼",
        desc: "有车牌 可以电话搜索询问",
        date: "11.18",
        publish_time: "2022.11.18"
      },
      {
        image: '../../images/banner2.jpeg',
        name: "兰博基尼",
        region: "江北校区中1d",
        desc: "有车牌 可以电话搜索询问",
        date: "11.18",
        publish_time: "2022.11.18"
      },
      {
        image: '../../images/banner1.jpeg',
        name: "特斯拉",
        region: "江北校区东区食堂",
        desc: "有车牌 可以电话搜索询问",
        date: "11.18",
        publish_time: "2022.11.18"
      },
      {
        image: '../../images/banner3.jpeg',
        name: "布加迪",
        region: "江北校区公楼",
        desc: "有车牌 可以电话搜索询问",
        date: "11.18",
        publish_time: "2022.11.18"
      },
      {
        image: '../../images/banner2.jpeg',
        name: "兰博基尼",
        region: "江北校区中1d",
        desc: "有车牌 可以电话搜索询问",
        date: "11.18",
        publish_time: "2022.11.18"
      },
      {
        image: '../../images/banner1.jpeg',
        name: "特斯拉",
        region: "江北校区东区食堂",
        desc: "有车牌 可以电话搜索询问",
        date: "11.18",
        publish_time: "2022.11.18"
      },
      {
        image: '../../images/banner3.jpeg',
        name: "布加迪",
        region: "江北校区公楼",
        desc: "有车牌 可以电话搜索询问",
        date: "11.18",
        publish_time: "2022.11.18"
      },
      {
        image: '../../images/banner2.jpeg',
        name: "兰博基尼",
        region: "江北校区中1d",
        desc: "有车牌 可以电话搜索询问",
        date: "11.18",
        publish_time: "2022.11.18"
      },
      {
        image: '../../images/banner1.jpeg',
        name: "特斯拉",
        region: "江北校区东区食堂",
        desc: "有车牌 可以电话搜索询问",
        date: "11.18",
        publish_time: "2022.11.18"
      }
    ]
  },
  selectTab(e) {
    // 可以通过打印 e 获取currentTarget等书写与对应变量的位置
      const { id } = e.currentTarget.dataset;
      this.setData({
        tabSelected: id
      })
  },
  toDetail() {
    wx.navigateTo({
      url: '../infoDetail/infoDetail',
    })
  },
  toSearch() {
    wx.navigateTo({
      url: '../search/search',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    if(typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        select: 0
      })
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})